package com.gxa.meiye.admin.platform.controller;


import com.gxa.meiye.admin.platform.pojo.vo.TherapistVo;
import com.gxa.meiye.admin.platform.pojo.vo.UpdateTherapistStatusVo;
import com.gxa.meiye.admin.platform.service.TherapistddService;
import com.gxa.meiye.core.common.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Api
@RestController
@RequestMapping("/platform/therapist")
public class TherapistddController {
    @Autowired
    private TherapistddService therapistService;

    @ApiOperation("美疗师列表")
    @GetMapping("/list")
    public Map userList(){
        List<TherapistVo> therapistVos = therapistService.selectTherapistList();
        JsonResult jsonResult = new JsonResult();
        jsonResult.setMsg("查询成功");
        jsonResult.setCode("200");
        jsonResult.setData(therapistVos);
        return jsonResult.getMap();
    }

    @ApiOperation("修改美疗师状态")
    @PostMapping("/updateStatus")
    public Map updateStatus(@RequestBody UpdateTherapistStatusVo therapistStatusVo){
        therapistService.updateStatus(therapistStatusVo);
        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode("200");
        return jsonResult.getMap();
    }

    @ApiOperation("查询美疗师")
    @PostMapping("/selectTherapists")
    public Map selectTherapists(String select){
        List<TherapistVo> therapistVos = therapistService.selectTherapists(select);
        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode("200");
        jsonResult.setMsg("查询成功");
        jsonResult.setData(therapistVos);
        return jsonResult.getMap();
    }
}
